﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using OgilvyOne.Model;
using OgilvyOne.BLL;
using System.IO;
public partial class admin_allergy_info_keywords_detail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.headers.Text = new ColumnBll().LayeridColumnConNaiv("1,179,216");

            int columnid = int.Parse(Request.Params["columnid"]);
            if (Request.Params["id"] != null && Request.Params["id"] != "")
            {
                nestle_kewords info = new nestle_kewords();
                DataTable dt = BLLArticleInfo.getallkeywords(Request.Params["id"].ToString());
                foreach (DataRow row in dt.Rows)
                {
                    this.id.Value = row["id"].ToString();
                    this.keyword.Text = row["keword"].ToString();
                    this.num.Text = row["num"].ToString();
                    this.recommend.SelectedValue = row["recommend"].ToString();
                    this.status.SelectedValue = row["status"].ToString();
                   
                }
            }

        }

    }


    protected void Sub_click(object sender, EventArgs e)
    {
        int id = 0;
        if (Request.Params["id"] != null && Request.Params["id"] != "")
        {
            id = int.Parse(this.id.Value);
        }
        nestle_kewords info = new nestle_kewords();
        info.Keword = this.keyword.Text;
        info.Num = Convert.ToInt32(this.num.Text);
        info.Recommend = this.recommend.SelectedValue;
        info.Status = this.status.SelectedValue;
        //if (this.islive.SelectedValue=="1")
        //{
        //    if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "")
        //    {

        //        Response.Write("<script>alert('请选择日期和时间');location.href='http://www.baidu.com';</script>");
        //    }
        //    else
        //    {
        //    }
        //}
        info.Id = id;
        if (id > 0)
        {
            bool r = BLLArticleInfo.Updatekeyword(info);
        }
        else
        {
            BLLArticleInfo.insertkeyword(info);
        }
        Response.Redirect("info_keywords.aspx?columnid=" + Request.Params["columnid"] + "&layerid=" + Request.Params["layerid"], true);
    }
}
